﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine ;

namespace 提交管理平台V1
{
    public partial class reportpreviewFrm : Form
    {
        ReportDocument RDoc;

        public reportpreviewFrm(DataSet ds,string strReportFileName)
        {
            InitializeComponent();
            try
            {
                RDoc = new ReportDocument();
                RDoc.Load(strReportFileName);
                RDoc.SetDataSource(ds);
                crystalReportViewer1.ReportSource = RDoc;
            }
            catch (Exception ex)
            {
                MessageBox.Show("发生错误：" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }

        private void reportpreviewFrm_FormClosed(object sender, FormClosedEventArgs e)
        {
            RDoc.Dispose();
        }
    }
}